Skip to content

Fix #9. Variables related to term I are not being updated when using setPID#10

Open
blandown wants to merge 1 commit intotekdemo:masterfrom
blandown:dev
Open

Fix #9. Variables related to term I are not being updated when using setPID#10
blandown wants to merge 1 commit intotekdemo:masterfrom
blandown:dev

Conversation

@blandown
Copy link

@blandown blandown commented Feb 4, 2021

When using the setPID () method, the errorSum and maxError variables are not being updated.

This can cause problems in a situation like

m_pid = new MiniPID (10, 0, 0); // I = 0
m_pid-> setOutputLimits (-100, 100); // maxError = 0, maxIOutput = 200
m_pid-> setPID (10,10,10); // maxError continues 0

the output of term I will always be 0 due to the following line

Ioutput=I*errorSum;

.....

else if (maxIOutput! = 0) {
        errorSum = clamp (errorSum + error, -maxError, maxError);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant